# @Time : 2020/6/29 10:37
# @Author : Fioman 
# @Phone : 13149920693
"""
你会发现,对元组t来说,t[:]不创建副本,而是返回同一个对象的引用.此外,tuple(t)获得的也是同一个元组的引用.
"""

t1 = (1, 2, 3)
t2 = tuple(t1)
print("t2 is t1 : {}".format(t2 is t1))

t3 = t1[:]
print("t3 is t1 : {}".format(t3 is t1))

"""
t1,t2,t3绑定到了同一个对象.
str,bytes,frozenset实例也有这种行为.注意,frozenset实例不是序列,因此不能使用fs[:].
但是,fs.copy()具有相同的效果:它会欺骗你,返回同一个对象的引用,而不是创建一个副本.
字符串字面量可能会创建共享的对象
"""

t4 = (4, 5, 6)
t5 = (4, 5, 6)
print("t4 is t5 : {}".format(t4 is t5))

s1 = "ABC"
s2 = "ABC"
print("s2 is s1 : {}".format(s2 is s1))
